package org.genntii.warehousesystem.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.genntii.warehousesystem.domain.entity.GoodsType;

import java.util.List;

@Mapper
public interface GoodsTypeMapper extends BaseMapper<GoodsType> {

    @Select("select type_id from goods_type where goods_id = #{id}")
    List<Integer> selectTypeId(@Param("id")int id);

    @Select("select * from goods_type where id = #{goodsId}")
    List<GoodsType> showAllGoodsTypeByGoodsId(@Param("goodsId")int goodsId);

    @Delete("delete from goods_type where goods_id = #{goodsId} and type_id = #{typeId}")
    void del(@Param("goodsId")int goodsId,@Param("typeId")int typeId);

    @Select("select goods_id from goods_type where type_id = #{typeId} limit #{page},10")
    List<Integer> selectGoodsIdByTYpeId(@Param("typeId")int typeId,@Param("page")int page);

}
